package com.hzhk.happyrent.ui.adapter.card;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hzhk.happyrent.App;
import com.hzhk.happyrent.R;
import com.hzhk.happyrent.bean.card.BankHotModel;
import com.hzhk.happyrent.ui.adapter.BaseAdapter;
import com.hzhk.happyrent.utils.glide.ShowImageUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by soft_zzc on 2017/11/26.
 */

public class CardYuyueAdapter extends BaseAdapter<BankHotModel.DataBean.BankBean> {


    private Logger log = LoggerFactory.getLogger(this.getClass().getName());
    private BankHotModel bankHotModel;

    public CardYuyueAdapter(Context context) {
        super(context);
        log.debug("jump into CardHotAdapter");
    }

    @Override
    public View getView(int position, View convertView, ViewGroup arg2) {
        CardYuyueAdapter.ViewHolder viewHolder;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_bank_yuyue, null);
            viewHolder = new CardYuyueAdapter.ViewHolder(convertView,position,mContext);
            viewHolder.setData(mList.get(position));
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (CardYuyueAdapter.ViewHolder) convertView.getTag();
            viewHolder.setData(mList.get(position));
        }
        return convertView;
    }

    static class ViewHolder {

        @BindView(R.id.card_top_pic)
        ImageView cardTopPic;
        @BindView(R.id.bank_hot_text1)
        TextView bankHotText1;
        @BindView(R.id.li_card_hot_bank)
        LinearLayout li_card_yuyue_bank;
        int position ;
        private Context context;
        ViewHolder(View view,int position,Context mConText) {
            this.position = position;
            this.context = mConText;
            ButterKnife.bind(this, view);
        }
        public void setData(final BankHotModel.DataBean.BankBean bankBean) {
            ShowImageUtils.showImageView(App.getContext(),cardTopPic,bankBean.getImage());
            bankHotText1.setText(bankBean.getTitle());

        }
    }
}
